const { createObjectId } = require("../db/mongo_util");
const model = require("../model/channel");
const {
    getPostedBody,
    respondSuccess,
    respondErr,
} = require("../utils/http_util");

function addChannel(postedBody) {
    return model.addChannel(postedBody);
}

async function deleteChannel(id) {
    return model.deleteChannel({ _id: createObjectId(id) });
}

function updateChannel(id, reqBoby) {
    return model.updateChannel({ _id: createObjectId(id) }, reqBoby);
}

async function getAllChannels() {
    return model.getAllChannels();
}

module.exports = {
    addChannel,
    deleteChannel,
    updateChannel,
    getAllChannels,
};
